package com.ssy.lingxi.purchase.repository;

import com.ssy.lingxi.purchase.entity.quotedprice.QuotedPriceTurn;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface QuotedPriceTurnRepository extends JpaRepository<QuotedPriceTurn, Long>, JpaSpecificationExecutor<QuotedPriceTurn> {

    List<QuotedPriceTurn> findAllByQuotedPriceId(Long quotedId, Sort sort);

    QuotedPriceTurn findByQuotedPriceIdAndTurn(Long id, Integer turn);

    List<QuotedPriceTurn> findByQuotedPriceIdInAndTurn(List<Long> ids, Integer turn);

    List<QuotedPriceTurn> findByPurchaseInquiryIdAndTurn(Long id, Integer turn);

    List<QuotedPriceTurn> findByPurchaseInquiryIdAndTurnAndStatus(Long id, Integer turn, Integer status);

    void deleteAllByQuotedPriceId(Long quotedPriceId);

    void deleteAllByQuotedPriceIdIn(List<Long> ids);
}
